#coding=utf-8
from socket import  *
HOST = '127.0.0.1'
PORT = 21567
BUFZIZ = 1024
ADDR = (HOST,PORT)

tcpCliSock = socket(AF_INET,SOCK_STREAM)
tcpCliSock.connect(ADDR)

while True:
    data = input('>>')
    if data == '':
        break

    tcpCliSock.send(data.encode())

    data = tcpCliSock.recv(BUFZIZ)

    if not data:
        break

    print(data.decode())

    tcpCliSock.close()